
/*
'===============================================================================
'  Generated From - CSharp_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  ** 
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class SqlClientEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'abstract' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  public class YourObject :  _YourObject
'  {
'
'  }
'
'===============================================================================
*/

// Generated by MyGeneration Version # (1.1.3.0)

using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.Collections.Specialized;

using MyGeneration.dOOdads;

namespace dOOdad_QueryTester
{
	public abstract class _Employees : SqlClientEntity
	{
		public _Employees()
		{
			this.QuerySource = "Employees";
			this.MappingName = "Employees";

		}	

		//=================================================================
		//  public Overrides void AddNew()
		//=================================================================
		//
		//=================================================================
		public override void AddNew()
		{
			base.AddNew();
			
		}
		
		
		public override void FlushData()
		{
			this._whereClause = null;
			this._aggregateClause = null;
			base.FlushData();
		}
		
		//=================================================================
		//  	public Function LoadAll() As Boolean
		//=================================================================
		//  Loads all of the records in the database, and sets the currentRow to the first row
		//=================================================================
		public bool LoadAll() 
		{
			ListDictionary parameters = null;
			
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_EmployeesLoadAll]", parameters);
		}
	
		//=================================================================
		// public Overridable Function LoadByPrimaryKey()  As Boolean
		//=================================================================
		//  Loads a single row of via the primary key
		//=================================================================
		public virtual bool LoadByPrimaryKey(int EmployeeID)
		{
			ListDictionary parameters = new ListDictionary();
			parameters.Add(Parameters.EmployeeID, EmployeeID);

		
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_EmployeesLoadByPrimaryKey]", parameters);
		}
		
		#region Parameters
		protected class Parameters
		{
			
			public static SqlParameter EmployeeID
			{
				get
				{
					return new SqlParameter("@EmployeeID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter LastName
			{
				get
				{
					return new SqlParameter("@LastName", SqlDbType.NVarChar, 20);
				}
			}
			
			public static SqlParameter FirstName
			{
				get
				{
					return new SqlParameter("@FirstName", SqlDbType.NVarChar, 10);
				}
			}
			
			public static SqlParameter Title
			{
				get
				{
					return new SqlParameter("@Title", SqlDbType.NVarChar, 30);
				}
			}
			
			public static SqlParameter TitleOfCourtesy
			{
				get
				{
					return new SqlParameter("@TitleOfCourtesy", SqlDbType.NVarChar, 25);
				}
			}
			
			public static SqlParameter BirthDate
			{
				get
				{
					return new SqlParameter("@BirthDate", SqlDbType.DateTime, 0);
				}
			}
			
			public static SqlParameter HireDate
			{
				get
				{
					return new SqlParameter("@HireDate", SqlDbType.DateTime, 0);
				}
			}
			
			public static SqlParameter Address
			{
				get
				{
					return new SqlParameter("@Address", SqlDbType.NVarChar, 60);
				}
			}
			
			public static SqlParameter City
			{
				get
				{
					return new SqlParameter("@City", SqlDbType.NVarChar, 15);
				}
			}
			
			public static SqlParameter Region
			{
				get
				{
					return new SqlParameter("@Region", SqlDbType.NVarChar, 15);
				}
			}
			
			public static SqlParameter PostalCode
			{
				get
				{
					return new SqlParameter("@PostalCode", SqlDbType.NVarChar, 10);
				}
			}
			
			public static SqlParameter Country
			{
				get
				{
					return new SqlParameter("@Country", SqlDbType.NVarChar, 15);
				}
			}
			
			public static SqlParameter HomePhone
			{
				get
				{
					return new SqlParameter("@HomePhone", SqlDbType.NVarChar, 24);
				}
			}
			
			public static SqlParameter Extension
			{
				get
				{
					return new SqlParameter("@Extension", SqlDbType.NVarChar, 4);
				}
			}
			
			public static SqlParameter Photo
			{
				get
				{
					return new SqlParameter("@Photo", SqlDbType.Image, 2147483647);
				}
			}
			
			public static SqlParameter Notes
			{
				get
				{
					return new SqlParameter("@Notes", SqlDbType.NText, 1073741823);
				}
			}
			
			public static SqlParameter ReportsTo
			{
				get
				{
					return new SqlParameter("@ReportsTo", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter PhotoPath
			{
				get
				{
					return new SqlParameter("@PhotoPath", SqlDbType.NVarChar, 255);
				}
			}
			
		}
		#endregion		
	
		#region ColumnNames
		public class ColumnNames
		{  
            public const string EmployeeID = "EmployeeID";
            public const string LastName = "LastName";
            public const string FirstName = "FirstName";
            public const string Title = "Title";
            public const string TitleOfCourtesy = "TitleOfCourtesy";
            public const string BirthDate = "BirthDate";
            public const string HireDate = "HireDate";
            public const string Address = "Address";
            public const string City = "City";
            public const string Region = "Region";
            public const string PostalCode = "PostalCode";
            public const string Country = "Country";
            public const string HomePhone = "HomePhone";
            public const string Extension = "Extension";
            public const string Photo = "Photo";
            public const string Notes = "Notes";
            public const string ReportsTo = "ReportsTo";
            public const string PhotoPath = "PhotoPath";

			static public string ToPropertyName(string columnName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[EmployeeID] = _Employees.PropertyNames.EmployeeID;
					ht[LastName] = _Employees.PropertyNames.LastName;
					ht[FirstName] = _Employees.PropertyNames.FirstName;
					ht[Title] = _Employees.PropertyNames.Title;
					ht[TitleOfCourtesy] = _Employees.PropertyNames.TitleOfCourtesy;
					ht[BirthDate] = _Employees.PropertyNames.BirthDate;
					ht[HireDate] = _Employees.PropertyNames.HireDate;
					ht[Address] = _Employees.PropertyNames.Address;
					ht[City] = _Employees.PropertyNames.City;
					ht[Region] = _Employees.PropertyNames.Region;
					ht[PostalCode] = _Employees.PropertyNames.PostalCode;
					ht[Country] = _Employees.PropertyNames.Country;
					ht[HomePhone] = _Employees.PropertyNames.HomePhone;
					ht[Extension] = _Employees.PropertyNames.Extension;
					ht[Photo] = _Employees.PropertyNames.Photo;
					ht[Notes] = _Employees.PropertyNames.Notes;
					ht[ReportsTo] = _Employees.PropertyNames.ReportsTo;
					ht[PhotoPath] = _Employees.PropertyNames.PhotoPath;

				}
				return (string)ht[columnName];
			}

			static private Hashtable ht = null;			 
		}
		#endregion
		
		#region PropertyNames
		public class PropertyNames
		{  
            public const string EmployeeID = "EmployeeID";
            public const string LastName = "LastName";
            public const string FirstName = "FirstName";
            public const string Title = "Title";
            public const string TitleOfCourtesy = "TitleOfCourtesy";
            public const string BirthDate = "BirthDate";
            public const string HireDate = "HireDate";
            public const string Address = "Address";
            public const string City = "City";
            public const string Region = "Region";
            public const string PostalCode = "PostalCode";
            public const string Country = "Country";
            public const string HomePhone = "HomePhone";
            public const string Extension = "Extension";
            public const string Photo = "Photo";
            public const string Notes = "Notes";
            public const string ReportsTo = "ReportsTo";
            public const string PhotoPath = "PhotoPath";

			static public string ToColumnName(string propertyName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[EmployeeID] = _Employees.ColumnNames.EmployeeID;
					ht[LastName] = _Employees.ColumnNames.LastName;
					ht[FirstName] = _Employees.ColumnNames.FirstName;
					ht[Title] = _Employees.ColumnNames.Title;
					ht[TitleOfCourtesy] = _Employees.ColumnNames.TitleOfCourtesy;
					ht[BirthDate] = _Employees.ColumnNames.BirthDate;
					ht[HireDate] = _Employees.ColumnNames.HireDate;
					ht[Address] = _Employees.ColumnNames.Address;
					ht[City] = _Employees.ColumnNames.City;
					ht[Region] = _Employees.ColumnNames.Region;
					ht[PostalCode] = _Employees.ColumnNames.PostalCode;
					ht[Country] = _Employees.ColumnNames.Country;
					ht[HomePhone] = _Employees.ColumnNames.HomePhone;
					ht[Extension] = _Employees.ColumnNames.Extension;
					ht[Photo] = _Employees.ColumnNames.Photo;
					ht[Notes] = _Employees.ColumnNames.Notes;
					ht[ReportsTo] = _Employees.ColumnNames.ReportsTo;
					ht[PhotoPath] = _Employees.ColumnNames.PhotoPath;

				}
				return (string)ht[propertyName];
			}

			static private Hashtable ht = null;			 
		}			 
		#endregion	

		#region StringPropertyNames
		public class StringPropertyNames
		{  
            public const string EmployeeID = "s_EmployeeID";
            public const string LastName = "s_LastName";
            public const string FirstName = "s_FirstName";
            public const string Title = "s_Title";
            public const string TitleOfCourtesy = "s_TitleOfCourtesy";
            public const string BirthDate = "s_BirthDate";
            public const string HireDate = "s_HireDate";
            public const string Address = "s_Address";
            public const string City = "s_City";
            public const string Region = "s_Region";
            public const string PostalCode = "s_PostalCode";
            public const string Country = "s_Country";
            public const string HomePhone = "s_HomePhone";
            public const string Extension = "s_Extension";
            public const string Notes = "s_Notes";
            public const string ReportsTo = "s_ReportsTo";
            public const string PhotoPath = "s_PhotoPath";

		}
		#endregion		
		
		#region Properties
	
		public virtual int EmployeeID
	    {
			get
	        {
				return base.Getint(ColumnNames.EmployeeID);
			}
			set
	        {
				base.Setint(ColumnNames.EmployeeID, value);
			}
		}

		public virtual string LastName
	    {
			get
	        {
				return base.Getstring(ColumnNames.LastName);
			}
			set
	        {
				base.Setstring(ColumnNames.LastName, value);
			}
		}

		public virtual string FirstName
	    {
			get
	        {
				return base.Getstring(ColumnNames.FirstName);
			}
			set
	        {
				base.Setstring(ColumnNames.FirstName, value);
			}
		}

		public virtual string Title
	    {
			get
	        {
				return base.Getstring(ColumnNames.Title);
			}
			set
	        {
				base.Setstring(ColumnNames.Title, value);
			}
		}

		public virtual string TitleOfCourtesy
	    {
			get
	        {
				return base.Getstring(ColumnNames.TitleOfCourtesy);
			}
			set
	        {
				base.Setstring(ColumnNames.TitleOfCourtesy, value);
			}
		}

		public virtual DateTime BirthDate
	    {
			get
	        {
				return base.GetDateTime(ColumnNames.BirthDate);
			}
			set
	        {
				base.SetDateTime(ColumnNames.BirthDate, value);
			}
		}

		public virtual DateTime HireDate
	    {
			get
	        {
				return base.GetDateTime(ColumnNames.HireDate);
			}
			set
	        {
				base.SetDateTime(ColumnNames.HireDate, value);
			}
		}

		public virtual string Address
	    {
			get
	        {
				return base.Getstring(ColumnNames.Address);
			}
			set
	        {
				base.Setstring(ColumnNames.Address, value);
			}
		}

		public virtual string City
	    {
			get
	        {
				return base.Getstring(ColumnNames.City);
			}
			set
	        {
				base.Setstring(ColumnNames.City, value);
			}
		}

		public virtual string Region
	    {
			get
	        {
				return base.Getstring(ColumnNames.Region);
			}
			set
	        {
				base.Setstring(ColumnNames.Region, value);
			}
		}

		public virtual string PostalCode
	    {
			get
	        {
				return base.Getstring(ColumnNames.PostalCode);
			}
			set
	        {
				base.Setstring(ColumnNames.PostalCode, value);
			}
		}

		public virtual string Country
	    {
			get
	        {
				return base.Getstring(ColumnNames.Country);
			}
			set
	        {
				base.Setstring(ColumnNames.Country, value);
			}
		}

		public virtual string HomePhone
	    {
			get
	        {
				return base.Getstring(ColumnNames.HomePhone);
			}
			set
	        {
				base.Setstring(ColumnNames.HomePhone, value);
			}
		}

		public virtual string Extension
	    {
			get
	        {
				return base.Getstring(ColumnNames.Extension);
			}
			set
	        {
				base.Setstring(ColumnNames.Extension, value);
			}
		}

		public virtual byte[] Photo
	    {
			get
	        {
				return base.GetByteArray(ColumnNames.Photo);
			}
			set
	        {
				base.SetByteArray(ColumnNames.Photo, value);
			}
		}

		public virtual string Notes
	    {
			get
	        {
				return base.Getstring(ColumnNames.Notes);
			}
			set
	        {
				base.Setstring(ColumnNames.Notes, value);
			}
		}

		public virtual int ReportsTo
	    {
			get
	        {
				return base.Getint(ColumnNames.ReportsTo);
			}
			set
	        {
				base.Setint(ColumnNames.ReportsTo, value);
			}
		}

		public virtual string PhotoPath
	    {
			get
	        {
				return base.Getstring(ColumnNames.PhotoPath);
			}
			set
	        {
				base.Setstring(ColumnNames.PhotoPath, value);
			}
		}


		#endregion
		
		#region String Properties
	
		public virtual string s_EmployeeID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.EmployeeID) ? string.Empty : base.GetintAsString(ColumnNames.EmployeeID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.EmployeeID);
				else
					this.EmployeeID = base.SetintAsString(ColumnNames.EmployeeID, value);
			}
		}

		public virtual string s_LastName
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.LastName) ? string.Empty : base.GetstringAsString(ColumnNames.LastName);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.LastName);
				else
					this.LastName = base.SetstringAsString(ColumnNames.LastName, value);
			}
		}

		public virtual string s_FirstName
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.FirstName) ? string.Empty : base.GetstringAsString(ColumnNames.FirstName);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.FirstName);
				else
					this.FirstName = base.SetstringAsString(ColumnNames.FirstName, value);
			}
		}

		public virtual string s_Title
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Title) ? string.Empty : base.GetstringAsString(ColumnNames.Title);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Title);
				else
					this.Title = base.SetstringAsString(ColumnNames.Title, value);
			}
		}

		public virtual string s_TitleOfCourtesy
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.TitleOfCourtesy) ? string.Empty : base.GetstringAsString(ColumnNames.TitleOfCourtesy);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.TitleOfCourtesy);
				else
					this.TitleOfCourtesy = base.SetstringAsString(ColumnNames.TitleOfCourtesy, value);
			}
		}

		public virtual string s_BirthDate
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.BirthDate) ? string.Empty : base.GetDateTimeAsString(ColumnNames.BirthDate);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.BirthDate);
				else
					this.BirthDate = base.SetDateTimeAsString(ColumnNames.BirthDate, value);
			}
		}

		public virtual string s_HireDate
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.HireDate) ? string.Empty : base.GetDateTimeAsString(ColumnNames.HireDate);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.HireDate);
				else
					this.HireDate = base.SetDateTimeAsString(ColumnNames.HireDate, value);
			}
		}

		public virtual string s_Address
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Address) ? string.Empty : base.GetstringAsString(ColumnNames.Address);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Address);
				else
					this.Address = base.SetstringAsString(ColumnNames.Address, value);
			}
		}

		public virtual string s_City
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.City) ? string.Empty : base.GetstringAsString(ColumnNames.City);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.City);
				else
					this.City = base.SetstringAsString(ColumnNames.City, value);
			}
		}

		public virtual string s_Region
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Region) ? string.Empty : base.GetstringAsString(ColumnNames.Region);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Region);
				else
					this.Region = base.SetstringAsString(ColumnNames.Region, value);
			}
		}

		public virtual string s_PostalCode
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.PostalCode) ? string.Empty : base.GetstringAsString(ColumnNames.PostalCode);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.PostalCode);
				else
					this.PostalCode = base.SetstringAsString(ColumnNames.PostalCode, value);
			}
		}

		public virtual string s_Country
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Country) ? string.Empty : base.GetstringAsString(ColumnNames.Country);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Country);
				else
					this.Country = base.SetstringAsString(ColumnNames.Country, value);
			}
		}

		public virtual string s_HomePhone
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.HomePhone) ? string.Empty : base.GetstringAsString(ColumnNames.HomePhone);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.HomePhone);
				else
					this.HomePhone = base.SetstringAsString(ColumnNames.HomePhone, value);
			}
		}

		public virtual string s_Extension
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Extension) ? string.Empty : base.GetstringAsString(ColumnNames.Extension);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Extension);
				else
					this.Extension = base.SetstringAsString(ColumnNames.Extension, value);
			}
		}

		public virtual string s_Notes
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Notes) ? string.Empty : base.GetstringAsString(ColumnNames.Notes);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Notes);
				else
					this.Notes = base.SetstringAsString(ColumnNames.Notes, value);
			}
		}

		public virtual string s_ReportsTo
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ReportsTo) ? string.Empty : base.GetintAsString(ColumnNames.ReportsTo);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ReportsTo);
				else
					this.ReportsTo = base.SetintAsString(ColumnNames.ReportsTo, value);
			}
		}

		public virtual string s_PhotoPath
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.PhotoPath) ? string.Empty : base.GetstringAsString(ColumnNames.PhotoPath);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.PhotoPath);
				else
					this.PhotoPath = base.SetstringAsString(ColumnNames.PhotoPath, value);
			}
		}


		#endregion		
	
		#region Where Clause
		public class WhereClause
		{
			public WhereClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffWhereParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffWhereParameter(this);
					}

					return _tearOff;
				}
			}

			#region WhereParameter TearOff's
			public class TearOffWhereParameter
			{
				public TearOffWhereParameter(WhereClause clause)
				{
					this._clause = clause;
				}
				
				
				public WhereParameter EmployeeID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.EmployeeID, Parameters.EmployeeID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter LastName
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.LastName, Parameters.LastName);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter FirstName
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.FirstName, Parameters.FirstName);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Title
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Title, Parameters.Title);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter TitleOfCourtesy
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.TitleOfCourtesy, Parameters.TitleOfCourtesy);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter BirthDate
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.BirthDate, Parameters.BirthDate);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter HireDate
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.HireDate, Parameters.HireDate);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Address
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Address, Parameters.Address);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter City
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.City, Parameters.City);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Region
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Region, Parameters.Region);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter PostalCode
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.PostalCode, Parameters.PostalCode);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Country
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Country, Parameters.Country);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter HomePhone
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.HomePhone, Parameters.HomePhone);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Extension
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Extension, Parameters.Extension);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Photo
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Photo, Parameters.Photo);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Notes
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Notes, Parameters.Notes);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter ReportsTo
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ReportsTo, Parameters.ReportsTo);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter PhotoPath
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.PhotoPath, Parameters.PhotoPath);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}


				private WhereClause _clause;
			}
			#endregion
		
			public WhereParameter EmployeeID
		    {
				get
		        {
					if(_EmployeeID_W == null)
	        	    {
						_EmployeeID_W = TearOff.EmployeeID;
					}
					return _EmployeeID_W;
				}
			}

			public WhereParameter LastName
		    {
				get
		        {
					if(_LastName_W == null)
	        	    {
						_LastName_W = TearOff.LastName;
					}
					return _LastName_W;
				}
			}

			public WhereParameter FirstName
		    {
				get
		        {
					if(_FirstName_W == null)
	        	    {
						_FirstName_W = TearOff.FirstName;
					}
					return _FirstName_W;
				}
			}

			public WhereParameter Title
		    {
				get
		        {
					if(_Title_W == null)
	        	    {
						_Title_W = TearOff.Title;
					}
					return _Title_W;
				}
			}

			public WhereParameter TitleOfCourtesy
		    {
				get
		        {
					if(_TitleOfCourtesy_W == null)
	        	    {
						_TitleOfCourtesy_W = TearOff.TitleOfCourtesy;
					}
					return _TitleOfCourtesy_W;
				}
			}

			public WhereParameter BirthDate
		    {
				get
		        {
					if(_BirthDate_W == null)
	        	    {
						_BirthDate_W = TearOff.BirthDate;
					}
					return _BirthDate_W;
				}
			}

			public WhereParameter HireDate
		    {
				get
		        {
					if(_HireDate_W == null)
	        	    {
						_HireDate_W = TearOff.HireDate;
					}
					return _HireDate_W;
				}
			}

			public WhereParameter Address
		    {
				get
		        {
					if(_Address_W == null)
	        	    {
						_Address_W = TearOff.Address;
					}
					return _Address_W;
				}
			}

			public WhereParameter City
		    {
				get
		        {
					if(_City_W == null)
	        	    {
						_City_W = TearOff.City;
					}
					return _City_W;
				}
			}

			public WhereParameter Region
		    {
				get
		        {
					if(_Region_W == null)
	        	    {
						_Region_W = TearOff.Region;
					}
					return _Region_W;
				}
			}

			public WhereParameter PostalCode
		    {
				get
		        {
					if(_PostalCode_W == null)
	        	    {
						_PostalCode_W = TearOff.PostalCode;
					}
					return _PostalCode_W;
				}
			}

			public WhereParameter Country
		    {
				get
		        {
					if(_Country_W == null)
	        	    {
						_Country_W = TearOff.Country;
					}
					return _Country_W;
				}
			}

			public WhereParameter HomePhone
		    {
				get
		        {
					if(_HomePhone_W == null)
	        	    {
						_HomePhone_W = TearOff.HomePhone;
					}
					return _HomePhone_W;
				}
			}

			public WhereParameter Extension
		    {
				get
		        {
					if(_Extension_W == null)
	        	    {
						_Extension_W = TearOff.Extension;
					}
					return _Extension_W;
				}
			}

			public WhereParameter Photo
		    {
				get
		        {
					if(_Photo_W == null)
	        	    {
						_Photo_W = TearOff.Photo;
					}
					return _Photo_W;
				}
			}

			public WhereParameter Notes
		    {
				get
		        {
					if(_Notes_W == null)
	        	    {
						_Notes_W = TearOff.Notes;
					}
					return _Notes_W;
				}
			}

			public WhereParameter ReportsTo
		    {
				get
		        {
					if(_ReportsTo_W == null)
	        	    {
						_ReportsTo_W = TearOff.ReportsTo;
					}
					return _ReportsTo_W;
				}
			}

			public WhereParameter PhotoPath
		    {
				get
		        {
					if(_PhotoPath_W == null)
	        	    {
						_PhotoPath_W = TearOff.PhotoPath;
					}
					return _PhotoPath_W;
				}
			}

			private WhereParameter _EmployeeID_W = null;
			private WhereParameter _LastName_W = null;
			private WhereParameter _FirstName_W = null;
			private WhereParameter _Title_W = null;
			private WhereParameter _TitleOfCourtesy_W = null;
			private WhereParameter _BirthDate_W = null;
			private WhereParameter _HireDate_W = null;
			private WhereParameter _Address_W = null;
			private WhereParameter _City_W = null;
			private WhereParameter _Region_W = null;
			private WhereParameter _PostalCode_W = null;
			private WhereParameter _Country_W = null;
			private WhereParameter _HomePhone_W = null;
			private WhereParameter _Extension_W = null;
			private WhereParameter _Photo_W = null;
			private WhereParameter _Notes_W = null;
			private WhereParameter _ReportsTo_W = null;
			private WhereParameter _PhotoPath_W = null;

			public void WhereClauseReset()
			{
				_EmployeeID_W = null;
				_LastName_W = null;
				_FirstName_W = null;
				_Title_W = null;
				_TitleOfCourtesy_W = null;
				_BirthDate_W = null;
				_HireDate_W = null;
				_Address_W = null;
				_City_W = null;
				_Region_W = null;
				_PostalCode_W = null;
				_Country_W = null;
				_HomePhone_W = null;
				_Extension_W = null;
				_Photo_W = null;
				_Notes_W = null;
				_ReportsTo_W = null;
				_PhotoPath_W = null;

				this._entity.Query.FlushWhereParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffWhereParameter _tearOff;
			
		}
	
		public WhereClause Where
		{
			get
			{
				if(_whereClause == null)
				{
					_whereClause = new WhereClause(this);
				}
		
				return _whereClause;
			}
		}
		
		private WhereClause _whereClause = null;	
		#endregion
	
		#region Aggregate Clause
		public class AggregateClause
		{
			public AggregateClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffAggregateParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffAggregateParameter(this);
					}

					return _tearOff;
				}
			}

			#region AggregateParameter TearOff's
			public class TearOffAggregateParameter
			{
				public TearOffAggregateParameter(AggregateClause clause)
				{
					this._clause = clause;
				}
				
				
				public AggregateParameter EmployeeID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.EmployeeID, Parameters.EmployeeID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter LastName
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.LastName, Parameters.LastName);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter FirstName
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.FirstName, Parameters.FirstName);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Title
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Title, Parameters.Title);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter TitleOfCourtesy
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.TitleOfCourtesy, Parameters.TitleOfCourtesy);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter BirthDate
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.BirthDate, Parameters.BirthDate);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter HireDate
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.HireDate, Parameters.HireDate);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Address
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Address, Parameters.Address);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter City
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.City, Parameters.City);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Region
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Region, Parameters.Region);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter PostalCode
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.PostalCode, Parameters.PostalCode);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Country
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Country, Parameters.Country);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter HomePhone
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.HomePhone, Parameters.HomePhone);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Extension
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Extension, Parameters.Extension);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Photo
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Photo, Parameters.Photo);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Notes
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Notes, Parameters.Notes);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter ReportsTo
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ReportsTo, Parameters.ReportsTo);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter PhotoPath
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.PhotoPath, Parameters.PhotoPath);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}


				private AggregateClause _clause;
			}
			#endregion
		
			public AggregateParameter EmployeeID
		    {
				get
		        {
					if(_EmployeeID_W == null)
	        	    {
						_EmployeeID_W = TearOff.EmployeeID;
					}
					return _EmployeeID_W;
				}
			}

			public AggregateParameter LastName
		    {
				get
		        {
					if(_LastName_W == null)
	        	    {
						_LastName_W = TearOff.LastName;
					}
					return _LastName_W;
				}
			}

			public AggregateParameter FirstName
		    {
				get
		        {
					if(_FirstName_W == null)
	        	    {
						_FirstName_W = TearOff.FirstName;
					}
					return _FirstName_W;
				}
			}

			public AggregateParameter Title
		    {
				get
		        {
					if(_Title_W == null)
	        	    {
						_Title_W = TearOff.Title;
					}
					return _Title_W;
				}
			}

			public AggregateParameter TitleOfCourtesy
		    {
				get
		        {
					if(_TitleOfCourtesy_W == null)
	        	    {
						_TitleOfCourtesy_W = TearOff.TitleOfCourtesy;
					}
					return _TitleOfCourtesy_W;
				}
			}

			public AggregateParameter BirthDate
		    {
				get
		        {
					if(_BirthDate_W == null)
	        	    {
						_BirthDate_W = TearOff.BirthDate;
					}
					return _BirthDate_W;
				}
			}

			public AggregateParameter HireDate
		    {
				get
		        {
					if(_HireDate_W == null)
	        	    {
						_HireDate_W = TearOff.HireDate;
					}
					return _HireDate_W;
				}
			}

			public AggregateParameter Address
		    {
				get
		        {
					if(_Address_W == null)
	        	    {
						_Address_W = TearOff.Address;
					}
					return _Address_W;
				}
			}

			public AggregateParameter City
		    {
				get
		        {
					if(_City_W == null)
	        	    {
						_City_W = TearOff.City;
					}
					return _City_W;
				}
			}

			public AggregateParameter Region
		    {
				get
		        {
					if(_Region_W == null)
	        	    {
						_Region_W = TearOff.Region;
					}
					return _Region_W;
				}
			}

			public AggregateParameter PostalCode
		    {
				get
		        {
					if(_PostalCode_W == null)
	        	    {
						_PostalCode_W = TearOff.PostalCode;
					}
					return _PostalCode_W;
				}
			}

			public AggregateParameter Country
		    {
				get
		        {
					if(_Country_W == null)
	        	    {
						_Country_W = TearOff.Country;
					}
					return _Country_W;
				}
			}

			public AggregateParameter HomePhone
		    {
				get
		        {
					if(_HomePhone_W == null)
	        	    {
						_HomePhone_W = TearOff.HomePhone;
					}
					return _HomePhone_W;
				}
			}

			public AggregateParameter Extension
		    {
				get
		        {
					if(_Extension_W == null)
	        	    {
						_Extension_W = TearOff.Extension;
					}
					return _Extension_W;
				}
			}

			public AggregateParameter Photo
		    {
				get
		        {
					if(_Photo_W == null)
	        	    {
						_Photo_W = TearOff.Photo;
					}
					return _Photo_W;
				}
			}

			public AggregateParameter Notes
		    {
				get
		        {
					if(_Notes_W == null)
	        	    {
						_Notes_W = TearOff.Notes;
					}
					return _Notes_W;
				}
			}

			public AggregateParameter ReportsTo
		    {
				get
		        {
					if(_ReportsTo_W == null)
	        	    {
						_ReportsTo_W = TearOff.ReportsTo;
					}
					return _ReportsTo_W;
				}
			}

			public AggregateParameter PhotoPath
		    {
				get
		        {
					if(_PhotoPath_W == null)
	        	    {
						_PhotoPath_W = TearOff.PhotoPath;
					}
					return _PhotoPath_W;
				}
			}

			private AggregateParameter _EmployeeID_W = null;
			private AggregateParameter _LastName_W = null;
			private AggregateParameter _FirstName_W = null;
			private AggregateParameter _Title_W = null;
			private AggregateParameter _TitleOfCourtesy_W = null;
			private AggregateParameter _BirthDate_W = null;
			private AggregateParameter _HireDate_W = null;
			private AggregateParameter _Address_W = null;
			private AggregateParameter _City_W = null;
			private AggregateParameter _Region_W = null;
			private AggregateParameter _PostalCode_W = null;
			private AggregateParameter _Country_W = null;
			private AggregateParameter _HomePhone_W = null;
			private AggregateParameter _Extension_W = null;
			private AggregateParameter _Photo_W = null;
			private AggregateParameter _Notes_W = null;
			private AggregateParameter _ReportsTo_W = null;
			private AggregateParameter _PhotoPath_W = null;

			public void AggregateClauseReset()
			{
				_EmployeeID_W = null;
				_LastName_W = null;
				_FirstName_W = null;
				_Title_W = null;
				_TitleOfCourtesy_W = null;
				_BirthDate_W = null;
				_HireDate_W = null;
				_Address_W = null;
				_City_W = null;
				_Region_W = null;
				_PostalCode_W = null;
				_Country_W = null;
				_HomePhone_W = null;
				_Extension_W = null;
				_Photo_W = null;
				_Notes_W = null;
				_ReportsTo_W = null;
				_PhotoPath_W = null;

				this._entity.Query.FlushAggregateParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffAggregateParameter _tearOff;
			
		}
	
		public AggregateClause Aggregate
		{
			get
			{
				if(_aggregateClause == null)
				{
					_aggregateClause = new AggregateClause(this);
				}
		
				return _aggregateClause;
			}
		}
		
		private AggregateClause _aggregateClause = null;	
		#endregion
	
		protected override IDbCommand GetInsertCommand() 
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_EmployeesInsert]";
	
			CreateParameters(cmd);
			
			SqlParameter p;
			p = cmd.Parameters[Parameters.EmployeeID.ParameterName];
			p.Direction = ParameterDirection.Output;
    
			return cmd;
		}
	
		protected override IDbCommand GetUpdateCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_EmployeesUpdate]";
	
			CreateParameters(cmd);
			      
			return cmd;
		}
	
		protected override IDbCommand GetDeleteCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_EmployeesDelete]";
	
			SqlParameter p;
			p = cmd.Parameters.Add(Parameters.EmployeeID);
			p.SourceColumn = ColumnNames.EmployeeID;
			p.SourceVersion = DataRowVersion.Current;

  
			return cmd;
		}
		
		private IDbCommand CreateParameters(SqlCommand cmd)
		{
			SqlParameter p;
		
			p = cmd.Parameters.Add(Parameters.EmployeeID);
			p.SourceColumn = ColumnNames.EmployeeID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.LastName);
			p.SourceColumn = ColumnNames.LastName;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.FirstName);
			p.SourceColumn = ColumnNames.FirstName;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Title);
			p.SourceColumn = ColumnNames.Title;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.TitleOfCourtesy);
			p.SourceColumn = ColumnNames.TitleOfCourtesy;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.BirthDate);
			p.SourceColumn = ColumnNames.BirthDate;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.HireDate);
			p.SourceColumn = ColumnNames.HireDate;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Address);
			p.SourceColumn = ColumnNames.Address;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.City);
			p.SourceColumn = ColumnNames.City;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Region);
			p.SourceColumn = ColumnNames.Region;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.PostalCode);
			p.SourceColumn = ColumnNames.PostalCode;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Country);
			p.SourceColumn = ColumnNames.Country;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.HomePhone);
			p.SourceColumn = ColumnNames.HomePhone;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Extension);
			p.SourceColumn = ColumnNames.Extension;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Photo);
			p.SourceColumn = ColumnNames.Photo;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Notes);
			p.SourceColumn = ColumnNames.Notes;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.ReportsTo);
			p.SourceColumn = ColumnNames.ReportsTo;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.PhotoPath);
			p.SourceColumn = ColumnNames.PhotoPath;
			p.SourceVersion = DataRowVersion.Current;


			return cmd;
		}
	}
}
